package com.zbkj.crmeb.merchant.api.controller;

import com.crmeb.core.common.CommonResult;
import com.zbkj.crmeb.front.vo.BrandVo;
import com.zbkj.crmeb.store.response.ListByCateResponse;
import com.zbkj.crmeb.store.service.StoreBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 用户表 前端控制器
 */
@Slf4j
@RestController("MerBrandFrontController")
@RequestMapping("api/front/mer/brand")
@Api(tags = "品牌服务")
public class FontBrandController extends ApiBaseController {
    @Autowired
    StoreBrandService storeBrandService;

    /**
     * 城市服务树形结构数据
     */
    @ApiOperation(value = "小程序品牌列表")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult<List<BrandVo>> listBrand(HttpServletRequest request) {
        return CommonResult.success(storeBrandService.listBrand(getMerId(request)));
        //return CommonResult.success(storeBrandService.listBrandByMerId(getMerId(request)));
    }

    @ApiOperation(value = "根据分类查看热门品牌列表")
    @GetMapping(value = "/listByCate/{cateType}/{cateId}")
    public CommonResult<ListByCateResponse> listByCate(@PathVariable("cateType") @ApiParam(value = "分类类型 1男  2女  3儿童", required = true) Integer cateType,@PathVariable String cateId, HttpServletRequest request){
        return CommonResult.success(storeBrandService.listByCate(cateType, cateId, getMerId(request)));
    }
}



